import matplotlib.pyplot as plt
xs = []
ys = []
strengths = []
# 读取文件中的数据
with open('商场一楼手机信号强度.txt') as fp:
    for line in fp:
        x, y, strength = map(int, line.split(','))
        xs.append(x)
        ys.append(y)
        strengths.append(strength)
# 绘制散点图，s指大小，c指颜色，marker指符号形状
for x, y, s in zip(xs, ys, strengths):
    if s < 40:
        color = 'r'
    elif s < 70:
        color = 'b'
    else:
        color = 'g'
    plt.scatter(x, y, s=s, c=color, marker='*')
plt.xlabel('长度坐标',
            fontproperties='stkaiti',   # 设置中文字体
            fontsize=10)                 # 设置字号
plt.ylabel('宽\n度\n坐\n标',           # 每行显示一个字
            fontproperties='stkaiti',
            fontsize=10,
            rotation='horizontal')      # 设置文字方向
plt.title('商场内信号强度',
           fontproperties='stxingkai',
           fontsize=14)
plt.show()